/*     */ package com.qmsk.business.prize.sweepstakes.controller;
/*     */ 
/*     */ import com.qmsk.business.bussBill.bussBill.dao.BussBillDao;
/*     */ import com.qmsk.business.member.memberIntegralBill.dao.MemberIntegralBillDao;
/*     */ import com.qmsk.business.member.memberIntegralConsumeRecord.dao.MemberIntegralConsumeRecordDAO;
/*     */ import com.qmsk.business.member.memberIntegralDetail.dao.MemberIntegralDetailDAO;
/*     */ import com.qmsk.business.member.memberIntegralRule.dao.MemberIntegralRuleDAO;
/*     */ import com.qmsk.business.member.shopMember.dao.ShopMemberDAO;
/*     */ import com.qmsk.business.prize.lotteryNumber.dao.LotteryNumberDao;
/*     */ import com.qmsk.business.prize.prizeLevel.dao.PrizeLevelDao;
/*     */ import com.qmsk.business.prize.sweepstakes.dao.SweepstakesDao;
/*     */ import com.qmsk.business.prize.sweepstakes.dao.SweepstakesSet;
/*     */ import com.qmsk.business.prize.winnder.dao.WinnerDao;
/*     */ import com.qmsk.business.weixin.customMenu.weiXinUtil.WeiXinUtil;
/*     */ import com.utils.basic.CDateTimeComm;
/*     */ import com.utils.basic.ObjectComm;
/*     */ import com.utils.gson.in.GsonHeadOneRow;
/*     */ import com.utils.gson.out.GsonEbRst;
/*     */ import com.utils.gson.out.GsonEbRstData;
/*     */ import com.utils.jdbc.connection.DbConnection;
/*     */ import com.utils.web.RequestUtils;
/*     */ import com.utils.web.ResponseUtils;
/*     */ import java.util.Date;
/*     */ import java.util.HashMap;
/*     */ import java.util.Map;
/*     */ import javax.servlet.http.HttpServletRequest;
/*     */ import javax.servlet.http.HttpServletResponse;
/*     */ import org.apache.log4j.Logger;
/*     */ import org.springframework.beans.factory.annotation.Autowired;
/*     */ import org.springframework.stereotype.Controller;
/*     */ import org.springframework.web.bind.annotation.PathVariable;
/*     */ import org.springframework.web.bind.annotation.RequestMapping;
/*     */ 
/*     */ @Controller
/*     */ @RequestMapping({"sweepstakes"})
/*     */ public class SweepstakesCotroller
/*     */ {
/*  42 */   private static final Logger logger = Logger.getLogger(SweepstakesCotroller.class);
/*     */ 
/*     */   @Autowired
/*     */   private SweepstakesDao sweepstakesDao;
/*     */ 
/*     */   @Autowired
/*     */   private PrizeLevelDao prizeLevelDao;
/*     */ 
/*     */   @Autowired
/*     */   private ShopMemberDAO shopMemberDAO;
/*     */ 
/*     */   @Autowired
/*     */   private WinnerDao winnDao;
/*     */ 
/*     */   @Autowired
/*     */   private LotteryNumberDao lotteryNumberDao;
/*     */ 
/*     */   @Autowired
/*     */   private MemberIntegralRuleDAO memberIntegralRuleDAO;
/*     */ 
/*     */   @Autowired
/*     */   private MemberIntegralBillDao memberIntegralBillDao;
/*     */ 
/*     */   @Autowired
/*     */   private BussBillDao bussBillDao;
/*     */ 
/*     */   @Autowired
/*     */   private MemberIntegralDetailDAO memberIntegralDetailDAO;
/*     */ 
/*     */   @Autowired
/*     */   private SweepstakesSet swpSetDao;
/*     */ 
/*     */   @Autowired
/*     */   private MemberIntegralConsumeRecordDAO memberIntegralConsumeRecordDAO;
/*  66 */   private final int cjCount = 2;
/*     */ 
/*     */   @RequestMapping(value={"find/sweepstakesList/{pageIdx}/{pageSize}"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*     */   public void getShopList(HttpServletRequest request, HttpServletResponse response, @PathVariable("pageIdx") Integer nPageIdx, @PathVariable("pageSize") Short nPageSize)
/*     */   {
/*  79 */     nPageSize = RequestUtils.getRequestValidPageSize(nPageSize);
/*     */     try {
/*  81 */       Long shopId = RequestUtils.getLong(request, "shopId");
/*  82 */       if (shopId != null) {
/*  83 */         Map params = new HashMap();
/*  84 */         params.put("shopId", shopId);
/*  85 */         params.put("status", Integer.valueOf(2));
/*  86 */         GsonEbRst gsonEbRst = this.sweepstakesDao.getSweepstakesList(params, nPageIdx, nPageSize);
/*  87 */         ResponseUtils.setResponseResult(gsonEbRst, response);
/*  88 */         return; }
/*  89 */       ResponseUtils.setErrorMsgResponse("shopId获取失败", response);
/*     */     }
/*     */     catch (Exception e) {
/*  92 */       logger.error(e);
/*  93 */       ResponseUtils.setErrorMsgResponse(
/*  94 */         RequestUtils.getFindDataErrorMessage(request), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @RequestMapping(value={"find/sweepstakesLast"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*     */   public void getShopList(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/*     */     try {
/* 102 */       Long shopId = RequestUtils.getLong(request, "shopId");
/* 103 */       if (shopId != null) {
/* 104 */         Map params = new HashMap();
/* 105 */         params.put("shopId", shopId);
/* 106 */         params.put("typeId", Integer.valueOf(1));
/* 107 */         params.put("Status", Integer.valueOf(0));
/* 108 */         GsonEbRst gsonEbRst = this.sweepstakesDao.getSweepstakesListLast(params);
/* 109 */         ResponseUtils.setResponseResult(gsonEbRst, response);
/* 110 */         return; }
/* 111 */       ResponseUtils.setErrorMsgResponse("shopId获取失败", response);
/*     */     }
/*     */     catch (Exception e) {
/* 114 */       logger.error(e);
/* 115 */       ResponseUtils.setErrorMsgResponse(
/* 116 */         RequestUtils.getFindDataErrorMessage(request), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @RequestMapping(value={"find/particNumsCount/{swpId}"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*     */   public void findParticNum(HttpServletRequest request, HttpServletResponse response, @PathVariable("swpId") Integer swpId)
/*     */   {
/*     */     try
/*     */     {
/* 132 */       GsonHeadOneRow gsonOneRow = this.sweepstakesDao
/* 133 */         .getPrizeTypeId(swpId);
/* 134 */       Integer partNum = (Integer)gsonOneRow.getValueOfName("particNums");
/* 135 */       if (partNum.intValue() > 0) {
/* 136 */         ResponseUtils.setSuccessResponse(String.valueOf(partNum), response);
/* 137 */         return; }
/* 138 */       ResponseUtils.setErrorMsgResponse("查询参加人数出错", response);
/*     */     }
/*     */     catch (Exception e) {
/* 141 */       logger.error(e);
/* 142 */       ResponseUtils.setErrorMsgResponse(
/* 143 */         RequestUtils.getFindDataErrorMessage(request), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @RequestMapping(value={"find/allPrize/{swpId}"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*     */   public void findAllPrize(HttpServletRequest request, HttpServletResponse response, @PathVariable("swpId") Long swpId)
/*     */   {
/*     */     try
/*     */     {
/* 160 */       GsonEbRst g = this.prizeLevelDao.getGsonOfPrizeLeve(swpId);
/* 161 */       ResponseUtils.setResponseResult(g, response);
/*     */     } catch (Exception e) {
/* 163 */       logger.error(e);
/* 164 */       ResponseUtils.setErrorMsgResponse(
/* 165 */         RequestUtils.getFindDataErrorMessage(request), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @RequestMapping(value={"find/cjType"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*     */   public void cjType1(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/*     */     try {
/* 173 */       Map params = new HashMap();
/* 174 */       params.put("typeId", RequestUtils.getInt(request, "typeId"));
/* 175 */       GsonEbRst gsonEbRst = this.swpSetDao.selectSqlOfAllset(params);
/* 176 */       ResponseUtils.setResponseResult(gsonEbRst, response);
/*     */     } catch (Exception e) {
/* 178 */       logger.error(e);
/* 179 */       ResponseUtils.setErrorMsgResponse(
/* 180 */         RequestUtils.getFindDataErrorMessage(request), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @RequestMapping(value={"edit/checkPrize"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*     */   public void checkPrize(HttpServletRequest request, HttpServletResponse response) {
/*     */     try {
/* 187 */       String openId = ObjectComm.objectToString(request.getParameter("openId"));
/* 188 */       Long shopId = ObjectComm.objectToLong(request.getParameter("shopId"));
/* 189 */       Long swpId = ObjectComm.objectToLong(request.getParameter("swpID"));
/* 190 */       Integer swpType = ObjectComm.objectToInteger(request.getParameter("swpType"));
/*     */ 
/* 192 */       boolean isCons = false;
/*     */ 
/* 194 */       Long prizeleveId = Long.valueOf(0L);
/* 195 */       int nResult = 0;
/*     */ 
/* 197 */       GsonEbRst gsonEbRst = this.shopMemberDAO.getMemberCardInfoByShopIdAndOpenId(shopId, openId);
/* 198 */       Integer allintAmt = (Integer)gsonEbRst.getResult().getValueOfIdx(0, "integralAmount");
/* 199 */       Integer needAmt = Integer.valueOf(0);
/*     */ 
/* 202 */       GsonEbRst swp = this.sweepstakesDao.getSweepstakesById(swpId);
/*     */ 
/* 204 */       if (swp.getDataLength() == 0) {
/* 205 */         prizeleveId = Long.valueOf(-3L);
/*     */       }
/* 207 */       Integer status = (Integer)swp.getResult().getValueOfIdx(0, "status");
/* 208 */       if (status.intValue() != 0) {
/* 209 */         prizeleveId = Long.valueOf(-9L);
/*     */       }
/* 211 */       if (gsonEbRst.getResult().getDataLength() == 0) {
/* 212 */         prizeleveId = Long.valueOf(-1L);
/*     */       }
/*     */       else {
/* 215 */         Long memberId = ObjectComm.objectToLong(gsonEbRst.getResult().getValueOfIdx(0, "memberId"));
/* 216 */         String customerName = (String)gsonEbRst.getResult().getValueOfIdx(0, "customerName");
/* 217 */         logger.error("查询剩余次数");
/*     */         String[] head;
/*     */         Object[] data;
/* 218 */         if (memberId == null) {
/* 219 */           head = new String[] { "data" };
/* 220 */           data = new Object[] { Integer.valueOf(-5) };
/* 221 */           ResponseUtils.toGsonEbRst(head, data, response);
/* 222 */           return;
/*     */         }
/* 224 */         if (swpType.intValue() > 0) {
/* 225 */           GsonHeadOneRow swpSet = this.swpSetDao.selectSqlOfOneSet(swpType);
/* 226 */           if (swpSet == null) {
/* 227 */             prizeleveId = Long.valueOf(-3L);
/*     */           } else {
/* 229 */             Integer swpState = ObjectComm.objectToInteger(swpSet.getValueOfName("status"));
/* 230 */             if (swpState.intValue() != 0) {
/* 231 */               prizeleveId = Long.valueOf(-3L);
/*     */             } else {
/* 233 */               needAmt = (Integer)swpSet.getValueOfName("intAmt");
/* 234 */               if (swpType.intValue() == 1) {
/* 235 */                 if (allintAmt.intValue() < needAmt.intValue())
/* 236 */                   prizeleveId = Long.valueOf(-20L);
/*     */               }
/* 238 */               else if (swpType.intValue() == 2) {
/* 239 */                 if (allintAmt.intValue() < needAmt.intValue())
/* 240 */                   prizeleveId = Long.valueOf(-20L);
/*     */                 else {
/* 242 */                   isCons = true;
/*     */                 }
/*     */               }
/*     */             }
/*     */ 
/*     */           }
/*     */ 
/*     */         }
/*     */ 
/* 251 */         if (prizeleveId.longValue() < 0L) {
/* 252 */           head = new String[] { "data" };
/* 253 */           data = new Object[] { prizeleveId };
/* 254 */           ResponseUtils.toGsonEbRst(head, data, response);
/* 255 */           return;
/*     */         }
/*     */ 
/* 259 */         logger.error(memberId);
/* 260 */         logger.error(swpId);
/* 261 */         GsonHeadOneRow lottery = this.lotteryNumberDao.getNum(swpId, memberId);
/* 262 */         if (lottery == null) {
/* 263 */           String[] numHead = { "swpId", "memberId", "num", "time" };
/* 264 */           Object[] numData = { swpId, memberId, Integer.valueOf(1), new Date() };
/* 265 */           nResult = this.lotteryNumberDao.insertGsonHeadOneRow(new GsonHeadOneRow(numHead, numData));
/* 266 */           logger.error("添加");
/*     */         }
/*     */         else
/*     */         {
/* 276 */           Integer num = (Integer)lottery.getValueOfName("num");
/* 277 */           Date time = (Date)lottery.getValueOfName("time");
/* 278 */           Date now = new Date();
/* 279 */           if ((time != null) && (CDateTimeComm.dateToyyyymmdd(now).equals(CDateTimeComm.dateToyyyymmdd(time)))) {
/* 280 */             if (num.intValue() >= 2) {
/* 281 */               prizeleveId = Long.valueOf(-2L);
/* 282 */               String[] head1 = { "data" };
/* 283 */               Object[] data1 = { prizeleveId };
/* 284 */               ResponseUtils.toGsonEbRst(head1, data1, response);
/* 285 */               return;
/*     */             }
/*     */ 
/* 288 */             nResult = this.lotteryNumberDao.updateNum(swpId, memberId).intValue();
/*     */           }
/*     */           else {
/* 291 */             nResult = this.lotteryNumberDao.updateNumToOne(swpId, memberId).intValue();
/*     */           }
/*     */         }
/* 294 */         logger.error(Integer.valueOf(3));
/* 295 */         nResult = 1;
/* 296 */         if (nResult > 0) {
/* 297 */           GsonEbRst prizeList = this.prizeLevelDao.getGsonOfPrizeLeve(swpId);
/* 298 */           if (prizeList.getDataLength() == 0) {
/* 299 */             prizeleveId = Long.valueOf(0L);
/*     */           } else {
/* 301 */             Integer particNums = ObjectComm.objectToInteger(swp.getResult().getValueOfIdx(0, "particNums"), Integer.valueOf(0));
/* 302 */             Long prizeId = Long.valueOf(0L);
/*     */ 
/* 304 */             if (particNums.intValue() != 0)
/*     */             {
/* 307 */               Integer GoodNum = getRandom(particNums);
/* 308 */               Integer begin = Integer.valueOf(0);
/* 309 */               Integer end = Integer.valueOf(0);
/* 310 */               for (int i = 0; i < prizeList.getDataLength(); ++i) {
/* 311 */                 begin = end;
/* 312 */                 end = Integer.valueOf(end.intValue() + ObjectComm.objectToInteger(prizeList.getResult().getValueOfIdx(i, "winnersNum")).intValue());
/* 313 */                 if ((begin.intValue() < GoodNum.intValue()) && (end.intValue() > GoodNum.intValue())) {
/* 314 */                   prizeleveId = ObjectComm.objectToLong(prizeList.getResult().getValueOfIdx(i, "prizeLvId"), Integer.valueOf(0));
/* 315 */                   prizeId = ObjectComm.objectToLong(prizeList.getResult().getValueOfIdx(i, "prizeId"), Integer.valueOf(0));
/*     */                 }
/*     */               }
/*     */ 
/* 319 */               logger.error("是否中将：" + prizeleveId);
/* 320 */               if (prizeleveId.longValue() > 0L) {
/* 321 */                 nResult = this.prizeLevelDao.updateNumsBySwpId(swpId, prizeleveId).intValue();
/* 322 */                 logger.error("修改奖品数：" + swpId + "++" + prizeleveId);
/* 323 */                 if (nResult > 0)
/*     */                 {
/* 325 */                   Date recBegin = (Date)swp.getResult().getValueOfIdx(0, "RecvBeginDate");
/* 326 */                   Date recEnd = (Date)swp.getResult().getValueOfIdx(0, "RecvEndDate");
/* 327 */                   Integer prizeTypeId = (Integer)swp.getResult().getValueOfIdx(0, "PrizeTypeId");
/* 328 */                   logger.error(prizeleveId + "))))" + swpId);
/* 329 */                   String[] heads = { "id", "memberId", "prizeId", "parizTypeId", "prizeLvId", "recBeginDate", "recEndDate", "createTime", "status" };
/* 330 */                   GsonHeadOneRow isInt = this.sweepstakesDao.checkExistOfSwpIdAndPrizeLeveAndIntRule(swpId, prizeleveId);
/*     */                   Object[] datas;
/*     */                   GsonHeadOneRow g;
/* 331 */                   if (isInt != null) {
/* 332 */                     datas = new Object[] { swpId, memberId, prizeId, prizeTypeId, prizeleveId, recBegin, recEnd, new Date(), "1" };
/* 333 */                     g = new GsonHeadOneRow(heads, datas);
/* 334 */                     nResult = this.winnDao.insertGsonHeadOneRow(g);
/* 335 */                     Integer ruleId = ObjectComm.objectToInteger(isInt.getValueOfName("intRuleId"));
/* 336 */                     logger.error("ruleId" + ruleId + "+" + nResult);
/*     */ 
/* 338 */                     if (nResult > 0) {
/* 339 */                       Integer intAmt = Integer.valueOf(0);
/* 340 */                       String intAmtContent = null;
/* 341 */                       GsonEbRst intg = this.memberIntegralRuleDAO.getGsonOfId(ruleId);
/* 342 */                       logger.error("ruleId" + intg.toString() + "+" + nResult);
/*     */ 
/* 344 */                       if ((intg != null) && (intg.getDataLength() > 0)) {
/* 345 */                         Long RuleID = (Long)intg.getResult().getValueOfIdx(0, "RuleID");
/* 346 */                         intAmt = (Integer)intg.getResult().getValueOfIdx(0, "FixedIntegral");
/* 347 */                         String RuleName = (String)intg.getResult().getValueOfIdx(0, "RuleName");
/* 348 */                         logger.error("ruleId" + ruleId);
/* 349 */                         logger.error("ruleId" + ruleId);
/* 350 */                         intAmtContent = ",您已获得" + intAmt + "个积分";
/* 351 */                         Integer factAdd = intAmt;
/* 352 */                         if (isCons) {
/* 353 */                           factAdd = Integer.valueOf(factAdd.intValue() - needAmt.intValue());
/*     */                         }
/* 355 */                         Map params = new HashMap();
/* 356 */                         params.put("memberId", memberId);
/* 357 */                         params.put("shopId", shopId);
/* 358 */                         params.put("intAmt", factAdd);
/* 359 */                         nResult = this.shopMemberDAO.updateBissBillAmountInc(params);
/* 360 */                         String billNO = this.bussBillDao.getMaxBillNo(shopId);
/* 361 */                         String[] head1 = { "ShopID", "BillNo", "MemberID", "CustName", "GotIntAmt" };
/* 362 */                         Object[] data1 = { shopId, billNO, memberId, customerName, intAmt };
/* 363 */                         nResult = this.bussBillDao.insertGsonHeadOneRow(new GsonHeadOneRow(head1, data1));
/* 364 */                         Long billId = this.bussBillDao.getLastId();
/* 365 */                         if ((nResult > 0) && (isCons)) {
/* 366 */                           String[] csmHead = { "WorkNo", "ConsumeIntegral", "MemberID", "BussID", "Memo", "Date" };
/* 367 */                           Object[] csmData = { billNO, needAmt, memberId, billId, "抽奖消耗", new Date() };
/* 368 */                           nResult = this.memberIntegralConsumeRecordDAO.insertGsonHeadOneRow(new GsonHeadOneRow(csmHead, csmData));
/*     */                         }
/* 370 */                         if (nResult > 0) {
/* 371 */                           nResult = this.memberIntegralBillDao.insertBsBillInAmtOfService(billNO, memberId, shopId, intAmt, RuleID, RuleName, null, null, billId, null);
/* 372 */                           if (nResult > 0) {
/* 373 */                             String[] detilHead = { "ShopID", "Integral", "MemberID", "BillID", "Status" };
/* 374 */                             Object[] detilData = { shopId, intAmt, memberId, billId, Integer.valueOf(0) };
/* 375 */                             nResult = this.memberIntegralDetailDAO.insertGsonHeadOneRow(new GsonHeadOneRow(detilHead, detilData));
/*     */ 
/* 377 */                             WeiXinUtil.sendTextMessageOfMain("恭喜您抽中" + intAmt + "积分", openId);
/*     */                           }
/*     */                         }
/*     */                       }
/*     */                     }
/*     */ 
/*     */                   }
/*     */                   else
/*     */                   {
/* 386 */                     datas = new Object[] { swpId, memberId, prizeId, prizeTypeId, prizeleveId, recBegin, recEnd, new Date(), "0" };
/* 387 */                     g = new GsonHeadOneRow(heads, datas);
/* 388 */                     nResult = this.winnDao.insertGsonHeadOneRow(g);
/* 389 */                     if (nResult > 0)
/*     */                     {
/* 391 */                       String billNO = this.bussBillDao.getMaxBillNo(shopId);
/* 392 */                       String[] head1 = { "ShopID", "BillNo", "MemberID", "CustName", "PayIntAmtMny" };
/* 393 */                       Object[] data1 = { shopId, billNO, memberId, customerName, needAmt };
/* 394 */                       nResult = this.bussBillDao.insertGsonHeadOneRow(new GsonHeadOneRow(head1, data1));
/* 395 */                       Long billId = this.bussBillDao.getLastId();
/* 396 */                       if ((nResult > 0) && (isCons)) {
/* 397 */                         String[] csmHead = { "WorkNo", "ConsumeIntegral", "MemberID", "BussID", "Memo", "Date" };
/* 398 */                         Object[] csmData = { billNO, needAmt, memberId, billId, "抽奖消耗", new Date() };
/* 399 */                         nResult = this.memberIntegralConsumeRecordDAO.insertGsonHeadOneRow(new GsonHeadOneRow(csmHead, csmData));
/* 400 */                         Map params = new HashMap();
/* 401 */                         params.put("memberId", memberId);
/* 402 */                         params.put("shopId", shopId);
/* 403 */                         params.put("intAmt", Integer.valueOf(-needAmt.intValue()));
/* 404 */                         nResult = this.shopMemberDAO.updateBissBillAmountInc(params);
/*     */                       }
/*     */                     }
/*     */                   }
/*     */                 }
/*     */                 else
/*     */                 {
/* 411 */                   prizeleveId = Long.valueOf(0L);
/*     */                 }
/*     */               }
/*     */               else {
/* 415 */                 logger.error("没中奖，扣减积分");
/* 416 */                 if (isCons) {
/* 417 */                   String billNO = this.bussBillDao.getMaxBillNo(shopId);
/* 418 */                   String[] head1 = { "ShopID", "BillNo", "MemberID", "CustName", "PayIntAmtMny", "stID" };
/* 419 */                   Object[] data1 = { shopId, billNO, memberId, customerName, needAmt, Integer.valueOf(100) };
/* 420 */                   nResult = this.bussBillDao.insertGsonHeadOneRow(new GsonHeadOneRow(head1, data1));
/* 421 */                   Long billId = this.bussBillDao.getLastId();
/* 422 */                   if ((nResult > 0) && (isCons)) {
/* 423 */                     String[] csmHead = { "WorkNo", "ConsumeIntegral", "MemberID", "BussID", "Memo", "Date" };
/* 424 */                     Object[] csmData = { billNO, needAmt, memberId, billId, "抽奖消耗", new Date() };
/* 425 */                     nResult = this.memberIntegralConsumeRecordDAO.insertGsonHeadOneRow(new GsonHeadOneRow(csmHead, csmData));
/* 426 */                     Map params = new HashMap();
/* 427 */                     params.put("memberId", memberId);
/* 428 */                     params.put("shopId", shopId);
/* 429 */                     params.put("intAmt", Integer.valueOf(-needAmt.intValue()));
/* 430 */                     nResult = this.shopMemberDAO.updateBissBillAmountInc(params);
/*     */                   }
/*     */ 
/*     */                 }
/*     */ 
/*     */               }
/*     */ 
/*     */             }
/*     */ 
/*     */           }
/*     */ 
/*     */         }
/*     */ 
/*     */       }
/*     */ 
/* 459 */       if (nResult > 0)
/* 460 */         DbConnection.commit();
/*     */       else {
/* 462 */         DbConnection.rollback();
/*     */       }
/* 464 */       String[] head = { "data" };
/* 465 */       Object[] data = { prizeleveId };
/* 466 */       ResponseUtils.toGsonEbRst(head, data, response);
/*     */     } catch (Exception e) {
/* 468 */       logger.error(e);
/* 469 */       DbConnection.rollback();
/* 470 */       ResponseUtils.setErrorMsgResponse(
/* 471 */         RequestUtils.getSqlUpdateDataErrorMessage(request) + ":" + 
/* 472 */         e.getMessage(), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   private boolean checkP(Integer number) {
/* 477 */     if ((number == null) || (number.intValue() == 0)) {
/* 478 */       return false;
/*     */     }
/* 480 */     Integer z = Integer.valueOf((int)(Math.random() * number.intValue()));
/*     */ 
/* 482 */     return (z.intValue() == 1);
/*     */   }
/*     */ 
/*     */   private Integer getRandom(Integer number)
/*     */   {
/* 489 */     if ((number == null) || (number.intValue() == 0)) {
/* 490 */       return Integer.valueOf(0);
/*     */     }
/* 492 */     return Integer.valueOf((int)(Math.random() * number.intValue()));
/*     */   }
/*     */ }

/* Location:           C:\Users\Administrator\Desktop\新建文件夹\WEB-INF\classes\
 * Qualified Name:     com.qmsk.business.prize.sweepstakes.controller.SweepstakesCotroller
 * JD-Core Version:    0.5.3
 */